<!DOCTYPE html>
<html lang="en">
<#header/>
<body>
<div class="layui-fluid">
    <form id="orgUserForm" action="/dept/doOrgUser.btl" class="layui-form layui-form-pane">
        <input type="hidden" name="orgId" value="${orgId}">
    <fieldset class="layui-elem-field">
        <legend>部门用户</legend>
        <div class="layui-field-box">
            @for(user in users){
            @if(user.password=='checked'){
            <input type="checkbox" name="userIds" value="${user.id}" title="${user.nickname}" checked>
            @}else{
            <input type="checkbox" name="userIds" value="${user.id}" title="${user.nickname}">
            @}
            @}
        </div>
    </fieldset>
        <button class="layui-btn" lay-submit lay-filter="orgUserForm">立即提交</button>
    </form>
</div>
<script>
    layui.use(["element","form","jquery","layer"],function(){
        var element = layui.element;
        var form = layui.form;
        var $ = layui.$;
        var layer = layui.layer;
        form.on('submit(orgUserForm)',function(data){
            $.post($("#orgUserForm").attr("action"),$("#orgUserForm").serialize(),function(data){
                if(data=="success"){
                    layer.msg('保存成功', {
                        time: 0 //不自动关闭
                        ,btn: ['关闭本窗口', '取消']
                        ,yes: function(index){
                            layer.close(index);
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        }
                    });
                }else if(data=="failed"){
                    lay.msg('保存失败');
                }
            });
            return false;
        });
    });
</script>
</body>
</html>